local skel = fk.CreateSkill{
  name = "emo__hanyong",
  tags = {Skill.Compulsory},
}

Fk:loadTranslationTable{
  ["emo__hanyong"] = "悍勇",
  [":emo__hanyong"] = "锁定技，每当你受到伤害后，你翻面，然后若此伤害不为火焰伤害，你分配1点伤害。",

  ["#emo__hanyong-choose"] = "悍勇：对1名角色造成1点伤害！",

  ["$emo__hanyong1"] = "犯我者，杀！",
  ["$emo__hanyong2"] = "藤甲军从无对手，不服来战！",
  ["$emo__hanyong3"] = "战火燃尽英雄胆！",
  ["$emo__hanyong4"] = "尔等，竟如此歹毒！",
}

skel:addEffect(fk.Damaged, {
  anim_type = "negative",
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(skel.name)
  end,
  on_cost = function (self, event, target, player, data) -- 修改配音，火伤为配音3、4
    local rnd = math.random(2)
    if data.damageType == fk.FireDamage then
      rnd = rnd + 2
    end
    event:setCostData(self, {audio_index = rnd})
    return true
  end,
  on_use = function(self, event, _, player, data)
    local room = player.room
    player:turnOver()
    if data.damageType == fk.FireDamage or player.dead then
      return
    end
    local tos = room:askToChoosePlayers(player, {
      min_num = 1, max_num = 1, targets = room.alive_players, skill_name = skel.name,
      prompt = "#emo__hanyong-choose", cancelable = false,
    })
    if #tos > 0 then
      room:damage { from = player, to = tos[1], damage = 1, skillName = skel.name }
    end
  end,
})

return skel
